﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Text;
using dis.sys.hw1.Contract;
using dis.sys.hw1.Model;

namespace dis.sys.hw1.ClientProxy
{
    public class HotelRegistrationProxy : ClientBase<IRegistrationService>, IRegistrationService
    {
        public HotelRegistrationProxy(ServiceEndpoint endpoint)
            : base(endpoint)
        {
        }

        public bool IsUp()
        {
            try
            {
                return Channel.IsUp();
            }
            catch (Exception)
            {
                return false;
            }
        }

        #region Implementation of IRegistrationService

        public void Register(string name, int port)
        {
            Channel.Register(name, port);
        }

        public void Unregister(string name)
        {
            Channel.Unregister(name);
        }



        public void InvalidateCacheLine(string hotelName, double stars, double rating)
        {
            Channel.InvalidateCacheLine(hotelName, stars, rating);
        }

        //UnUsed
        public IDictionary<Tuple<long, long, double, double>, Tuple<DateTime, IList<Hotel>>> QueryCache
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion
    }
}
